www.gusucode.com > Wind Turbine Model工具箱matlab源码 > Wind Turbine Model/Wind_Turbine_Model_R18a/Scripts/Setup_Pitch_Control_Design.m

    % Copyright 2009-2018 The MathWorks(TM), Inc.

BlocksToSwitch = 'Pitch Controller';

BlockPath = find_system('Wind_Turbine','FollowLinks','on','Name',BlocksToSwitch);

% GET BLOCK INFO (INSTANCE AND SOURCE)

SourceBlkHandle = get_param(char(BlockPath),'Handle');
TemplateBlk = get_param(char(BlockPath),'TemplateBlock');
slash_ind = findstr(TemplateBlk,'/');
ReplaceBlkFile = TemplateBlk(1:slash_ind);
ReplaceBlkName = get_param(char(BlockPath),'BlockChoice');
ReplaceBlkFull = [ReplaceBlkFile ReplaceBlkName];

% REPLACE BLOCK
replace_block('Wind_Turbine','Handle',SourceBlkHandle,ReplaceBlkFull);